<?php
/**
 * 密码操作
 */
//session_start();
include "../util/DBUtil.php";
//$login_type = $_SESSION['login_type'];//登录类型
//$login_user = unserialize($_SESSION['login_user']);//反解序列获登录用户信息
//$login_user = unserialize($_SESSION['login_user']);//反解序列获登录用户信息
include "../util/PromptAction.php";


$id = $_GET['id'];
$sql = "select * from tb_student where id=? ";
if ($login_type == 2) {//教师
    $sql = "select * from tb_teacher where id=?";
    $id = $login_user['id'];
}elseif ($login_type==0){//学生
    $sql = "select * from tb_student where id=?";
    $id = $login_user['id'];
}
$params = array($id);
$db = new DBUtil();
$result = $db->query($sql, $params)[0];
?>

<form action="../action/pwd_formOK.php" method="post">
    <input type="hidden" name="id" value="<?php echo $result['id'] ?>">
    <table>
        <?php if ($login_type == 1 || $login_type==0) {//管理员
            ?>
            <tr>
                <td>学号：</td>
                <td><input type="text" value="<?php echo $result['student_no'] ?>" disabled></td>
            </tr>
            <?php
        }else{//修改教师密码
            ?>
            <tr>
                <td>编号：</td>
                <td><input type="text" value="<?php echo $result['teacher_no'] ?>" disabled></td>
            </tr>
            <?php
        } ?>
        <tr>
            <td>姓名：</td>
            <td><input type="text" value="<?php echo $result['name'] ?>" disabled></td>
        </tr>
        <tr>
            <td>密码：</td>
            <td><input type="password" name="password" minlength="4" maxlength="4"></td>
        </tr>
    </table>
    <button type="submit" formtarget="<?php echo $login_type==1? 'info':'_top'?>">确定</button>
</form>

